﻿using MediatR;
using Warehouse.Domain;
using Warehouse.Infrstructre.Interface;
using Warehouse.Read.API.Applcation.Command.StorehouseCommand;

namespace Warehouse.Read.API.Applcation.CommandHandlers.StorehouseCommandhandlers
{
    public class FillStorehouseCommandHandlers:IRequestHandler<FillStorehouseCommand,StoreHouse>
    {
        IStorehouseRepository _storehouse;

        public FillStorehouseCommandHandlers(IStorehouseRepository storehouse)
        {
            _storehouse = storehouse;
        }


        public async Task<StoreHouse> Handle(FillStorehouseCommand request, CancellationToken cancellationToken)
        {
            return await _storehouse.GetModelAsync(request.Id);
        }
    }
}
